public class SumofRecur {
    public static void main(String [] args){
        int [] tmp = new int [args.length];
        for(int x=0;x<args.length;x++){
            tmp[x] = Integer.parseInt(args[x]);
        }
        for(int t:tmp){
            int sum=0;
            if(t<0)
                System.out.println("wrong");
            else{
                for(int i=1;i<=t;i++){
                    int a=1;
                    for(int j=1;j<=i;j++){
                        a=a*j;
                    }
                    sum=sum+a;
                }
                if(sum<0)
                    System.out.println("wrong");
                else
                    System.out.println(sum);
            }
        }
    }
}